
import java.util.PriorityQueue;
import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
//题目地址：https://www.lanqiao.cn/problems/3515/learning/
public class 整数删除 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        //整数个数
        int N = 0;
        //操作次数
        int K = 0;
        //按照从小到大排序
        PriorityQueue<long[]> queue = new PriorityQueue<>(((o1, o2) -> {
            if (o1[0] == o2[0]) {
                return Long.compare(o1[1], o2[1]);
            } else return Long.compare(o1[0], o2[0]);
        }));
        //输入操作数个数
        N = scan.nextInt();
        K = scan.nextInt();
        //输入具体的数字
        long[] arry = new long[N];
        for (int i = 0; i < N; i++) {
            arry[i] = scan.nextInt();
            //往队列里添加
            queue.add(new long[]{arry[i], i});
        }
        //操作数
        while (K > 0) {
            //取出最小的数
            long[] min = queue.poll();
            long num = min[0];
            int index = (int) min[1];
            //将取出的和原来的作比较
            if (num != arry[index]) {
                queue.add(new long[]{arry[index], index});
                continue;
            }
            //向左找
            for (int i = index - 1; i >= 0; i--) {
                if (arry[i] != -1) {
                    arry[i] += num;
                    break;
                }
            }
            //向右找
            for (int i = index + 1; i < N; i++) {
                if (arry[i] != -1) {
                    arry[i] += num;
                    break;
                }
            }
            arry[index] = -1;
            K--;
        }
        //操作完之后打印
        for (int i = 0; i < N; i++) {
            if (arry[i] != -1) {
                System.out.print(arry[i] + " ");
            }
        }
    }
}